﻿namespace Chain.Wechat
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Xml;

    public class VoiceResponse : IResponse
    {
        
        private string _MediaId;

        public VoiceResponse(IRequest req, string mediaId) : base(req)
        {
            base.Request = req;
            this.MediaId = mediaId;
            XmlNode xml = base.XmlDoc.GetElementsByTagName("xml")[0];
            XmlElement nodeMsgType = base.XmlDoc.CreateElement("MsgType");
            XmlCDataSection xmlCData = base.XmlDoc.CreateCDataSection("text");
            nodeMsgType.AppendChild(xmlCData);
            xml.AppendChild(nodeMsgType);
            XmlElement nodeVoice = base.XmlDoc.CreateElement("Voice");
            XmlElement nodeMediaId = base.XmlDoc.CreateElement("MediaId");
            xmlCData = base.XmlDoc.CreateCDataSection(mediaId);
            nodeMediaId.AppendChild(xmlCData);
            nodeVoice.AppendChild(nodeMediaId);
            xml.AppendChild(nodeVoice);
        }

        public string MediaId
        {
            
            get
            {
                return this._MediaId;
            }
            
            set
            {
                this._MediaId = value;
            }
        }
    }
}

